const pool = require("../pool.js");

const selectByReviewId = (reviewId) => {
  const sql = "SELECT * FROM js_app_comment WHERE review_id = ?";
  return query(sql, [reviewId]);
};
// 执行查询并返回Promise
const query = (sql, params) => {
  return new Promise((resolve, reject) => {
    pool.query(sql, params, (error, results, fields) => {
      if (error) {
        return reject(error);
      }
      resolve(results);
    });
  });
};

module.exports={selectByReviewId}